package com.qa.service.impl;

import com.qa.dao.TagMapper;
import com.qa.pojo.Tag;
import com.qa.service.ITagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author
 * @Date 2020/3/4 21:05
 * @Desc
 **/
@Service
public class TagServiceImpl implements ITagService {
    @Autowired
    private TagMapper tagMapper;

    @Override
    public List<Tag> getByEmail(String email) {
        return tagMapper.getByEmail(email);
    }

    @Override
    public void add(String email, String tagName) {
        Tag tag = new Tag();
        tag.setTagStatus(1);
        tag.setEmail(email);
        tag.setTagName(tagName);
        tagMapper.insert(tag);
    }

    @Override
    public void delete(Integer tagId) {
        tagMapper.deleteByPrimaryKey(tagId);
    }

    @Override
    public List<Tag> getAllByEmail(String email) {
        return tagMapper.getByEmail(email);
    }
}
